Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prime

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prime

prime, an OOP JavaScript library for node and the web.

  • 0.4.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.9K
increased by14.27%
Maintainers
2
Weekly downloads
 
Created
Source

prime

Package Info NPM Version Coverage Status Build Status Dependencies Status DevDependencies Status

  1. fundamental, basic, essential.
  2. make (something) ready for use or action.
  3. archetypal, prototypical, typical, classic.

Description

prime is an Object Oriented JavaScript library. It helps you with prototypal inheritance and contains generic utilities for every-day JavaScripting.

No Native JavaScript Objects were harmed in the making of this library.

Modules Overview

A short overview of the available modules. For more information, refer to the documentation.

prime

The function to create new primes.

var prime = require("prime")

var Animal = prime({
    say: function(){
        return "!!"
    }
})

var Emitter = require("prime/emitter")

var Cat = prime({
    inherits: Animal,
    mixin: Emitter,
    say: function(){
        return "meaow" + Cat.parent.say.call(this)
    }
})

prime/emitter

The event emitter.

var Emitter = require("prime/emitter")

var Dog = prime({
    inherits: Animal,
    mixin: Emitter,
    say: function(){
        var word = "wuff" + Dog.parent.say.call(this)
        this.emit("say", word)
        return word
    }
})

var barkley = new Dog

barkley.on("say", function(word){
    console.log("barkley barked", word)
})

prime/map

Map-like implementation.

var Map = require("prime/map")

var map = new Map()

map.set(domElement, "header")
map.set(domElement2, "footer")
map.get(domElement) // "header"
map.get(domElement2) // "footer"

prime/defer

Optimized timeouts / immediates / animationFrames.

var defer = require("prime/defer")

defer.frame(function() {
    console.log('on next animation frame');
});

defer.immediate(function() {
    console.log('on platform next tick.');
});

defer.timeout(function() {
    console.log('late');
}, 500);

When all else fails, read the full documentation.

Keywords

FAQs

Package last updated on 08 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc